<?php
if (!array_key_exists('DEBUG', $GLOBALS)) {
    header('Content-Type: application/octet-stream');
}

/*
* Messages description:
* messages should be sent via POST
* in a JSON array, each node in array will be a separate message also encoded in JSON
* if there are parameters to message, they should be also encoded in JSON (but not escaped)
* the whole array of messages must be subsequently compressed via DEFLATE algorithm level 5
* with ADLER32 checksum and 2 identification bytes
* and later encrypted via AES/CBC padded with spaces (MCrypt class)
*/

require_once 'Settings.php';
require_once 'ApplicationTCPConnection.php';
use \GrouppaGroup\ApplicationTCPConnection;

//CHECK: receive message and send it to ApplicationTCPConnection

$connectionHandler = new ApplicationTCPConnection();
//reading messages
$connectionHandler->loadMessages($HTTP_RAW_POST_DATA);
//send all the responses
$connectionHandler->sendAllResponses();
